﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<nelech.Models.DBModel.ForumResponse>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    פורום
    <%= Model.category.title %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("ForumSearchControl"); %>
    <h2>
        <%= Model.subject.title %></h2>
    <h4 class="forum">
        <%= Model.subject.text %></h4>

    <script language="javascript" type="text/javascript">

        function ShowText(id) {
            var e = document.getElementById("text" + id);
            e.style.display = e.style.display == "none" ? "block" : "none";
        }
          
    </script>

    <div class="tguva">
        <%= Html.ActionLink("הוסף תגובה", "CreateResponse", "Forum", new {id = Model.subject.id }, null)%></div>
    <ul class="forum">
        <% var parents = Model.responses.Where(p => p.p_id == Model.subject.id).ToList().OrderBy(p => p.id);
           foreach (var item in parents)
           { %>
        <li>
            <h5>
                <% Response.Write("<a href=\"javascript:ShowText(" + item.id + ")\">" + item.title + "</a>"); %></h5>
            <%
                if (string.IsNullOrEmpty(item.text.Trim()))
                { %>
            (ל"ת)
            <%} %>
            <p id="text<%= item.id %>" style="display: none">
                <%= item.text%>
            </p>
            <span class="forumName"><b>
                <%= item.name%></b>,
                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(item.date, true)%></span>
            <span class="tguva1">
                <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = item.id }, null)%></span>
            <ul>
                <%foreach (var res in Model.responses.Where(p => p.p_id == item.id))
                  { %>
                <li>
                    <h5>
                        <% Response.Write("<a href=\"javascript:ShowText(" + res.id + ")\">" + res.title + "</a>"); %></h5>
                    <%
                        if (string.IsNullOrEmpty(item.text.Trim()))
                        { %>
                    (ל"ת)
                    <%} %>
                    <div id="text<%= res.id %>" style="display: none">
                        <%= res.text%>
                    </div>
                    <span class="forumName"><b>
                        <%= res.name%></b>,
                        <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res.date, true)%></span>
                    <span class="tguva1">
                        <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res.id }, null)%>
                    </span>
                    <ul>    <%foreach (var res1 in Model.responses.Where(p => p.p_id == res.id))
                          { %>
                        <li>
                            <h5>
                                <% Response.Write("<a href=\"javascript:ShowText(" + res1.id + ")\">" + res1.title + "</a>"); %></h5>
                            <%
                                if (string.IsNullOrEmpty(item.text.Trim()))
                                { %>
                            (ל"ת)
                            <%} %>
                            <div id="text<%= res1.id %>" style="display: none">
                                <%= res1.text%>
                            </div>
                            <span class="forumName"><b>
                                <%= res1.name%></b>,
                                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res1.date, true)%></span>
                            <span class="tguva1">
                                <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res1.id}, null)%></span>
                            <ul>
                                <%foreach (var res2 in Model.responses.Where(p => p.p_id == res1.id))
                                  { %>
                                <li>
                                    <h5>
                                        <% Response.Write("<a href=\"javascript:ShowText(" + res2.id + ")\">" + res2.title + "</a>"); %></h5>
                                    <%
                                        if (string.IsNullOrEmpty(item.text.Trim()))
                                        { %>
                                    (ל"ת)
                                    <%} %>
                                    <div id="text<%= res2.id %>" style="display: none">
                                        <%= res2.text%>
                                    </div>
                                    <span class="forumName"><b>
                                        <%= res2.name%></b>,
                                        <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res2.date, true)%></span>
                                    <span class="tguva1">
                                        <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res2.id }, null)%></span>
                                    <ul>
                                        <%foreach (var res3 in Model.responses.Where(p => p.p_id == res2.id))
                                          { %>
                                        <li>
                                            <h5>
                                                <% Response.Write("<a href=\"javascript:ShowText(" + res3.id + ")\">" + res3.title + "</a>"); %></h5>
                                            <%
                                                if (string.IsNullOrEmpty(item.text.Trim()))
                                                { %>
                                            (ל"ת)
                                            <%} %>
                                            <div id="text<%= res3.id %>" style="display: none">
                                                <%= res3.text%>
                                            </div>
                                            <span class="forumName"><b>
                                                <%= res3.name%></b>,
                                                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res3.date, true)%></span>
                                        </li>
                                        <%}%>
                                    </ul>
                                </li>
                                <%}%>
                            </ul>
                        </li>
                        <%}%>
                    </ul>
                </li>
                <%}%>
            </ul>
        </li>
        <% } %>
    </ul>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="publishTop" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Right" runat="server">
</asp:Content>
